package com.lenovo.leos.filebrowser.netdisk;

import android.os.Bundle;

// maybe add mData to NetDiskOp
public class SimpleNetDiskOp extends NetDiskOp implements Cloneable {
	private static final String TAG = "SimpleNetDiskOp";
	
	public enum Type{
		login,
		get_space,
		get_dir_content,
		list_subdir_in_dir,
		list_files_in_dir,
		create_dir,
		delete_dir,
		rename_dir,
		move_dir,
		delete_file,
		rename_file,
		move_file,
		invalid,
		
		pause_load,
		resume_load,
		stop_load;
	}
	
	public enum State {
		none,
		ready,
		error,
		finish;
	}
	
	private Type mType = Type.invalid;
	private State mState = State.none;
	
	// [maybe] maybe add code to check the date is valid or not?
	public SimpleNetDiskOp(Type type, Bundle data) {
		super(data);
		
		if (type == Type.invalid || null == data){
			Log.e(TAG, "invalid parameter in SimpleNetDiskOp");
		}else{
			mType = type;
			mState = State.ready;			
		}
	}
	
	public Type getType() {
		return mType;
	}
	
	public State getState() {
		return mState;
	}
	
	public void setState(State state) {
		mState = state;
	}
	
	public Object clone() {
		SimpleNetDiskOp o = null;  
        try {  
            o = (SimpleNetDiskOp) super.clone();  
            o.mState = mState;
            o.mType = mType;
        } catch (CloneNotSupportedException e) {  
            e.printStackTrace();  
        }  
        return o; 
	}
}
